//
//  ViewController.m
//  任务列表4
//
//  Created by apple on 15/9/14.
//  Copyright (c) 2015年 戴维营. All rights reserved.
//

#import "ViewController.h"
#import "ValueTableViewCell.h"

@interface ViewController ()<UITableViewDataSource>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    
    tableView.dataSource = self;
    
    [tableView registerClass:[ValueTableViewCell class] forCellReuseIdentifier:@"cell"];
    
    [self.view addSubview:tableView];
    

    // Do any additional setup after loading the view, typically from a nib.
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    ValueTableViewCell *cell = (ValueTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    if (indexPath.row % 2)
    {
        cell.imageView.image = [UIImage imageNamed:@"abc"];
        cell.colorView.backgroundColor = [UIColor orangeColor];
    }
    else
        
    {
        cell.imageView.image = nil;
        cell.colorView.backgroundColor = [UIColor greenColor];
    }
    cell.textLabel.text = @"天王盖地虎，小鸡炖蘑菇！";
    cell.detailTextLabel.text = @"宝塔镇河妖！";
    
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
